
#ifndef __SERIAL_BLOCK_SINK_H
#define __SERIAL_BLOCK_SINK_H

#include <apr-1/apr_pools.h>
#include <apr-1/apr_thread_proc.h>
#include "../db/KeyDB.h"

class SerialBlockSink
{
   public:
      SerialBlockSink(const char *directorypath, apr_pool_t *imp);
      ~SerialBlockSink();
      int PutNextBlock(char *realbuffer, int *realsize);
      int PutNextBlockDecrypted(const char *cname, KeyPair *kp, const char *realbuffer, int *realsize, int *cesize, char **hash);
      int PutNextBlockDecrypted(const char *decwith, KeyDB *kdb, const char *realbuffer, int *realsize, int *cesize, char **hash);
   private:
      char *directory_name;
      apr_pool_t *mp;
      apr_procattr_t *pattr;
      apr_proc_t tproc;
};

#endif
